using MicroCloud.Entity.Defaults;
using MicroCloud.Log4Net;
using MicroCloud.Reflection;

namespace MicroCloud.CodeGenerator
{
    public class Startup
    {
        public void ConfigureServices(IServiceCollection services)
        {
            string[] filters = { "dotnet-", "Microsoft.", "mscorlib", "netstandard", "System", "Windows", "PropertyChanged" };
            AssemblyManager.AssemblyFilterFunc = name => name.Name != null && !filters.Any(m => name.Name.StartsWith(m));

            services.BuildeMicroCloud()
                .AddPack<ViewModelPack>()
                .AddPack<Log4NetPack>()
                .AddPack<AutoMapperPack>()
                .AddPack<DefaultDbContextMigrationPack>()
                .AddPack<CodeGenerationPack>();
        }

        public void Configure(IServiceProvider provider)
        {
            provider.UseMicroCloud();
        }
    }
}
